package Day1;

import java.lang.module.FindException;
import java.util.Scanner;
//移动位置
public class Yi1_3 {
    public static void main(String[] args) {
        int []ar={12,3,4,6,5,2,37,7};
        int []ar1=new  int[ar.length];
        Yi1_3.output(ar,ar.length);
        System.out.println("请输入要移动的下标");
        Scanner scanner = new Scanner(System.in);
        int dex= scanner.nextInt();
        int dex1=0;
       //提取前dex数据
        Yi1_3.qudex(ar1,ar,dex1,dex);
        //从dex下标开始移动
        //把dex里面数据接到后面
        Yi1_3.output(ar,ar.length);
    }

    public static void output(int[]ar,int len) {
        for (int i = 0; i < ar.length; i++) {
            System.out.print(" " + ar[i]);
        }
        System.out.println();
    }
    public static void qudex(int[]ar1 ,int[]ar,int dex1,int dex) {
        for (int i = 0; i < dex; i++) {
            ar1[i] = ar[i];
        }
        for (int j = dex; j < ar.length; j++) {
            ar[dex1++] = ar[j];
        }
        for (int i = 0; i < dex; i++) {
            ar[dex1++]=ar1[i];
        }
    }

}
